using System;
using System.ClientModel;
using System.ClientModel.Primitives;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text.Json;

namespace OpenAI.Embeddings;

[CodeGenType("CreateEmbeddingResponse")]
[CodeGenSuppress("Data")]
[CodeGenSuppress(nameof(OpenAIEmbeddingCollection))]
[CodeGenSuppress(nameof(OpenAIEmbeddingCollection), typeof(string), typeof(EmbeddingTokenUsage))]
#pragma warning disable SCME0001 // Type is for evaluation purposes only and is subject to change or removal in future updates.
[CodeGenSuppress(nameof(OpenAIEmbeddingCollection), typeof(string), typeof(string), typeof(EmbeddingTokenUsage), typeof(JsonPatch))]
#pragma warning disable SCME0001 // Type is for evaluation purposes only and is subject to change or removal in future updates.
public partial class OpenAIEmbeddingCollection : ReadOnlyCollection<OpenAIEmbedding>
{
    // CUSTOM: Made private. This property does not add value in the context of a strongly-typed class.
    /// <summary> The object type, which is always "list". </summary>
    [CodeGenMember("Object")]
    private string Object { get; } = "list";

    // CUSTOM: Set the inherited Items property via the base constructor in favor of the suppressed Data property.
    /// <summary> Initializes a new instance of <see cref="OpenAIEmbeddingCollection"/>. </summary>
    /// <param name="data"> The list of embeddings generated by the model. </param>
    /// <param name="model"> The name of the model used to generate the embedding. </param>
    /// <param name="usage"> The usage information for the request. </param>
    /// <exception cref="ArgumentNullException"> <paramref name="data"/>, <paramref name="model"/> or <paramref name="usage"/> is null. </exception>
    internal OpenAIEmbeddingCollection(IEnumerable<OpenAIEmbedding> data, string model, EmbeddingTokenUsage usage)
        : base([.. data])
    {
        Argument.AssertNotNull(data, nameof(data));
        Argument.AssertNotNull(model, nameof(model));
        Argument.AssertNotNull(usage, nameof(usage));

        Model = model;
        Usage = usage;
    }

    // CUSTOM: Set the inherited Items property via the base constructor in favor of the suppressed Data property.
    /// <summary> Initializes a new instance of <see cref="OpenAIEmbeddingCollection"/>. </summary>
    /// <param name="data"> The list of embeddings generated by the model. </param>
    /// <param name="model"> The name of the model used to generate the embedding. </param>
    /// <param name="object"> The object type, which is always "list". </param>
    /// <param name="usage"> The usage information for the request. </param>
    /// <param name="patch"> Keeps track of any properties unknown to the library. </param>
#pragma warning disable SCME0001 // Type is for evaluation purposes only and is subject to change or removal in future updates.
    internal OpenAIEmbeddingCollection(IReadOnlyList<OpenAIEmbedding> data, string model, string @object, EmbeddingTokenUsage usage, in JsonPatch patch)
        : base([.. data])
    {
        Model = model;
        Object = @object;
        Usage = usage;
        _patch = patch;
    }
#pragma warning disable SCME0001 // Type is for evaluation purposes only and is subject to change or removal in future updates.

    // CUSTOM: Set the inherited Items property via the base constructor in favor of the suppressed Data property.
    /// <summary> Initializes a new instance of <see cref="OpenAIEmbeddingCollection"/> for deserialization. </summary>
    internal OpenAIEmbeddingCollection()
        : base([])
    {
    }
}